/**
 * 
 */
package br.com.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Joelson
 * 
 */
@Entity(name = "tb_item_prioritario")
public class Item {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6887144842819123701L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	
	@Column(name = "cod_const")
	private int codigo;

	@Column(name = "descricao")
	private String descricao;

	@Temporal(TemporalType.DATE)
	@Column(name = "data_inc")
	private Date data_inclusao;

	public String getDescricao() {
		return descricao;
	}
	
	@ManyToOne
	private Constante constante;

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Date getData_inclusao() {
		return data_inclusao;
	}

	public void setData_inclusao(Date data_inclusao) {
		this.data_inclusao = data_inclusao;
	}

	public int getCodigo() {
		return codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}
	

	public void setId(Long id) {
		this.id = id;
	}

	public Constante getConstante() {
		return constante;
	}

	public void setConstante(Constante constante) {
		this.constante = constante;
	}

	public Long getId() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + codigo;
		result = prime * result + ((constante == null) ? 0 : constante.hashCode());
		result = prime * result + ((data_inclusao == null) ? 0 : data_inclusao.hashCode());
		result = prime * result + ((descricao == null) ? 0 : descricao.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Item other = (Item) obj;
		if (codigo != other.codigo)
			return false;
		if (constante == null) {
			if (other.constante != null)
				return false;
		} else if (!constante.equals(other.constante))
			return false;
		if (data_inclusao == null) {
			if (other.data_inclusao != null)
				return false;
		} else if (!data_inclusao.equals(other.data_inclusao))
			return false;
		if (descricao == null) {
			if (other.descricao != null)
				return false;
		} else if (!descricao.equals(other.descricao))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Item [id=" + id + ", codigo=" + codigo + ", descricao=" + descricao + ", data_inclusao=" + data_inclusao + ", constante=" + constante
				+ "]";
	}

	
}
